<template>
	<view class="goodLayout">
		<view class="images">
			<image :src="item.images[0]" mode="aspectFill"></image>
		</view>
		<view class="bottom">
			<view class="good-name">{{item.good_name}}</view>
			<view class="act">
				<view class="score">{{item.score}}积分</view>
				<view class="pay-btn" @click="goDetail(item.id)">兑换</view>
			</view>
		</view>
		<view class="stock">库存:{{item.stock}}</view>
	</view>
</template>

<script setup>
	defineProps(['item'])
	const goDetail = (id) => {
		uni.navigateTo({
			url: "/pages/shop/detail?id="+ id
		})
	}
</script>

<style lang="scss" scoped>
	.goodLayout {
		border: 1rpx solid #f4f5f6;
		border-radius: 18rpx;
		box-shadow: 0 3rpx 2rpx rgba(0, 0, 0, 0.08);
		position: relative;

		.stock {
			position: absolute;
			top: 20rpx;
			left: 0;
			background-color: rgba(0, 0, 0, 0.5);
			color: #fff;
			border-radius: 0 20rpx 20rpx 0;
			padding: 5rpx 10rpx;
			font-size: 20rpx;

		}

		.images {
			width: 325rpx;
			height: 307rpx;
			border-radius: 18rpx;
			overflow: hidden;
			margin-bottom: 20rpx;

			image {
				width: 100%;
				height: 100%;
			}
		}

		.bottom {
			padding: 10rpx;

			.good-name {
				color: #000;
				line-height: 38rpx;
				font-size: 30rpx;
				font-weight: 700;
				margin-bottom: 10rpx;
			}

			.act {
				display: flex;
				justify-content: space-between;
				align-items: center;

				.score {
					color: #ff4d4f;
					line-height: 38rpx;
					font-size: 28rpx;
				}

				.pay-btn {
					padding: 8rpx 20rpx;
					border-radius: 20rpx;
					background-color: $theme-color;
					color: #fff;
					font-size: 23rpx;
				}
			}
		}

	}
</style>